﻿<cfcomponent
	extends="MachII.mach-ii"
	output="no">

	<!---
	PROPERTIES - APPLICATION SPECIFIC
	--->
	<cfset this.name = "iMP_AcadmicManager" />
	<cfset this.clientStorage = "cookie" />
	<cfset this.sessionManagement = false />
	<cfset this.clientManagement = false />
	<cfset this.setClientCookies = false />
	<cfset this.setDomainCookies = true />
	<cfset this.applicationTimeOut = CreateTimeSpan(2,0,0,0) />

	<!---
	PROPERTIES - MACH-II SPECIFIC
	--->
	<!---Set the path to the application's mach-ii.xml file --->
	<cfset MACHII_CONFIG_PATH = ExpandPath("config/acadmicManager.xml") />
	<!--- Set the app key for sub-applications within a single cf-application. --->
	<cfset MACHII_APP_KEY =  GetFileFromPath(ExpandPath(".")) />
	<!--- Set the configuration mode (when to reinit): -1=never, 0=dynamic, 1=always --->
	<cfset MACHII_CONFIG_MODE = 0 />

	<!---
	PUBLIC FUNCTIONS
	--->
	<cffunction name="onApplicationStart" returnType="void" output="no"
		hint="Only runs when the App is started.">
		
		<cfsetting requesttimeout="30" />
		
		<cfset application.startTime = Now() />
		
		<cfset application.dnsSlave = "SOE" />
		<cfset application.dnsMaster = "SOE" />

		<cfset LoadFramework() />
		
	</cffunction>

	<cffunction name="onApplicationEnd" returntype="void" output="no"
		hint="Only runs when the App is shut down.">
		<cfargument name="ApplicationScope" required="true"/>
	</cffunction>

	<cffunction name="onRequestStart" returnType="void" output="true"
		hint="Run at the start of a page request.">
		<cfargument name="targetPage" type="string" required="true" />

		<!--- Request Scope Variable Defaults --->
		<cfset request.self = "index.cfm">
		<cfset request.tickBegin = GetTickCount() />

		<!--- 
			Temporarily override the default config mode
			Set the configuration mode (when to reinit): -1=never, 0=dynamic, 1=always 
		--->
		<cfif StructKeyExists(url, "reinit") and CGI.REMOTE_ADDR eq "127.0.0.1">
			<cfsetting requesttimeout="30" />
			<cfset MACHII_CONFIG_MODE = 1 />
		</cfif>
		
		<!--- Handle the request. Make sure we only process Mach-II requests. --->
		<cfif findNoCase('index.cfm', listLast(arguments.targetPage, '/'))>
			<cfset handleRequest() />
		</cfif>
	</cffunction>

</cfcomponent>